// ****************************************************************************
// *     Filename:  DetectorConstruction.hh
// *      Created:  2012-09-14 11:11:01
// *      Version:  1.0
// *     Revision:  0
// *       Author:  Tran Hoai Nam (nam), nam@kuno-g.phys.sci.osaka-u.ac.jp
// * Organization:  Osaka University
// *      License:  Geant4 Software License 
// *                http://geant4.cern.ch/license/LICENSE.html
// *  Description:  Detector header
// ****************************************************************************
#ifndef DETECTORCONSTRUCTION_CIFRJ3O5
#define DETECTORCONSTRUCTION_CIFRJ3O5

class G4LogicalVolume;
class G4VPhysicalVolume;
class G4Material;
class G4FieldManager;
class G4VisAttributes;
class G4SDManager;

#include "G4VUserDetectorConstruction.hh"

class DetectorConstruction : public G4VUserDetectorConstruction {
	public:
		DetectorConstruction ();
		virtual ~DetectorConstruction ();
	private:
		G4FieldManager *fpFieldMan;
		G4SDManager *fpSDMan;

		G4VPhysicalVolume *fpPhysWorld;
		G4LogicalVolume *fpLogChamber;
		G4LogicalVolume *fpLogBeamWindow;
		G4LogicalVolume *fpLogTrigPS; // triggering plastic scinti
		G4LogicalVolume *fpLogdESi;
		G4LogicalVolume *fpLogESi;
		G4LogicalVolume *fpLogVetoPS; // veto plastic, behind the Si dets
		G4LogicalVolume *fpLogTarget;
		G4LogicalVolume *fpLogColl;
		G4LogicalVolume *fpLogGe;

		G4double	fWorldX;
		G4double	fWorldY;
		G4double	fWorldZ;

		G4double 	fChamberR;
		G4double 	fChamberH;
		G4double 	fChamberT; // T for thickness
		G4double 	fVPortT; // view port/beam window
		G4double  fVPortR;
		G4double  fVPortExL; //Extrusion length
		G4double  fBeamWindowT;

		G4double  fTrigPST; // T for thickness
		G4double  fTrigPSL; // L for length

		G4double  fSiL;
		G4double  fdESiT;
		G4double  fESiT;
		G4double 	fVetoPST;
		G4double  fTargetT;
		G4double  fCollT;

		G4double  fGeR;
		G4double  fGeT;

		G4Material *fpVacuum;
		G4Material *fpAir;
		G4Material *fpCopper;
		G4Material *fpAluminum;
		G4Material *fpNaI;
		G4Material *fpSilicon;
		G4Material *fpLead;
		G4Material *fpPScinti; //plastic scintillator
		G4Material *fpSSteel; //stainless steel
		G4Material *fpMylar;
		G4Material *fpGermanium;

		G4VisAttributes *fpYellow;
		G4VisAttributes *fpRed;
		G4VisAttributes *fpGreen;
		G4VisAttributes *fpCyan;
		G4VisAttributes *fpMagenta;
		G4VisAttributes *fpGrey;
	public:
		G4VPhysicalVolume * Construct ();
		void SetMagField(G4double Bx, G4double By, G4double Bz);
		void DefineMaterials ();
		void SetColors();
		void SetDefaultParameters ();
		void BuildChamber ();
		void BuildDetectors();
		void AddSensitiveDetectors();
		G4double GetWorldZ() { return fWorldZ;}

};

#endif /* end of include guard: DETECTORCONSTRUCTION_CIFRJ3O5 */
